;/*!/common/widgets/header_c/modules/emailvalid/main.js*/
define('common/widgets/header_c/modules/emailvalid/main', ['require', 'exports', 'module', 'dep/jquery-colorbox/jquery.colorbox'], function(require, exports, module) {

    require('dep/jquery-colorbox/jquery.colorbox');

    //注册激活页: 重新发送验证邮件 copy from popup.js
    if ($('#resend').size() > 0) {
        $('#resend').click(function() {
            $.lgAjax({
                type: 'POST',
                url: GLOBAL_DOMAIN.ctx + '/user/resendActivatedMail'
            }).done(function(result) {
                if (result.success) {
                    $.colorbox({
                        inline: true,
                        href: "#resend_success",
                        title: "验证邮件发送成功"
                    });
                } else {
                    alert(result.msg);
                }
            });
        });
    }

    function dateToStr (date){
        return date.getFullYear().toString() + date.getMonth().toString() + date.getDate().toString();
    }
    // 点击就不激活，激活提示消失
    $('#notActive').click(function() {
        $("#remindActive").hide();
        var time = new Date();
        localStorage.setItem("timeStr",dateToStr(time));
    });
    var now = new Date();
    var nowStr = dateToStr(now);
    if(localStorage.getItem("timeStr") !== nowStr) {
        localStorage.removeItem("timeStr");
        $("#remindActive").show();
    }
    $(".verify").click(function(){
        location.href = $(this).attr("data-url");
    });


});

;/*!/common/widgets/header_c/layout/main.js*/
/**
 * header 入口文件
 *
 */

define('common/widgets/header_c/layout/main', ['require', 'exports', 'module', 'dep/jquery.cookie/jquery.cookie'], function(require, exports, module) {

    // 四周年logo
    // require('../../common/event/doodle-4th-birthday/main');
    require('dep/jquery.cookie/jquery.cookie');

    $(".passport .login").bind("click", function(e) {
        e.preventDefault();
        PASSPORT && PASSPORT.loginPopup();
    });
    $(".passport .register").bind("click", function(e) {
        e.preventDefault();
        PASSPORT && PASSPORT.registerPopup();
    });
    
});

;/*!/common/widgets/footer_c/layout/main.js*/
/**
 * footer 入口文件
 * 此文件从主站core.js 复制过来，未修改逻辑
 *
 * @copy by vee@lagou.com
 */

define('common/widgets/footer_c/layout/main', ['require', 'exports', 'module'], function(require, exports, module) {

	//footer-app, .footer_wechat
	$('.footer_app, .footer_wechat, .footer_mina').hover(function() {
		$('img', this).stop().fadeIn(200);
	}, function() {
		$('img', this).stop().fadeOut(200);
	});

	//back to top 回顶部
	$(window).scroll(function() {
		if ((document.documentElement.scrollTop || document.body.scrollTop) > 0) {
			$("#backtop").show();
		} else {
			$("#backtop").hide();
		}
	});
	$("#backtop").click(function() {
		pageScroll();
	});

	function pageScroll() {
		$("#backtop").css("background-position-x", "-38px");
		/* 匀速运动改为定时 */
		/*window.scrollBy(0, -20);
		if (document.documentElement.scrollTop == 0 && document.body.scrollTop == 0) {
			$("#backtop").css("background-position-x", "0");
			return;
		}
		scrolldelay = setTimeout(pageScroll, 2);*/
		$('html, body').animate({
			scrollTop: 0
		}, 1000, function() {
			$("#backtop").css("background-position-x", "0");
		});
	}

	function fixFooter(offset) {
		if ($(window).height() - offset > $(document.body).height()) {
			$('#footer').addClass('footer_fix');
		} else {
			$('#footer').removeClass('footer_fix');
		}
	}

	fixFooter(0);

	$(window).resize(function() {
		if ($('#footer').hasClass('footer_fix')) {
			fixFooter(356);
		} else {
			fixFooter(0);
		}
	});

    $(document).ready(function () {// 二维码图片兼容http/https，内容优先级延迟加载
        $('img[data-delay-src]').each(function () {
            var $me = $(this);
            var imgUrl = ($me.attr('data-delay-src') || '').replace(/https?\:/i, document.location.protocol); // 协议适配
            $me.attr('src', imgUrl.replace('www.lagou.com', window.GLOBAL_CDN_DOMAIN)); // 静态资源迁移
        });
    });

});
